import { createRouter, createWebHistory } from 'vue-router'
import IndexView from '@/views/IndexView.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: IndexView,
      children: [
        {
          path: '',
          component: () => import("@/components/IndexComponents/MainPart.vue")
        },
        {
          path: 'manager/freeback',
          component: () => import('@/components/Manager/FreebackPart.vue')
        },
        {
          path: 'manager/joinShop',
          component: () => import("@/components/Manager/JoinShopPart.vue")
        },
        {
          path: 'manager/joinSender',
          component: () => import('@/components/Manager/JoinSenderPart.vue')
        }
      ]
    },
    {
      path: '/auth',
      component: () => import('@/views/login/LoginView.vue'),
      children: [
        {
          path: 'login',
          name: 'login',
          component: () => import('@/components/LoginComponents/LoginPart.vue'),

        },
        {
          path: 'register',
          name: 'register',
          component: () => import('@/components/LoginComponents/RegisterPart.vue')
        },
        {
          path: '', // 这是一个空路径，表示/parent
          redirect: 'login' // 重定向到名为'default-child'的子路由
        },
      ]
    }
  ]
})

export default router
